﻿using System;

namespace CommonUtils
{
    public static class MathUtil
    {
        //除以
        public static double DivideBy(this double a, double b)
        {
            if (b == 0)
                return 0;
            return a / b;
        }

        //比例
        public static double Rate(this double a, double b)
        => a.DivideBy(b);

        public static int Power(this int value, int power)
        {
            //^ 是 异或
            return (int)Math.Pow(value, power);
        }
    }
}
